package com.taotao.entity;

import java.util.Objects;

/**
 * @author 余胜军
 * @ClassName ServiceInstance
 * @qq 644064779
 * @addres www.mayikt.com
 * 微信:yushengjun644
 */
public class ServiceInstance {
    /**
     * 服务名称
     */
    private String serviceName;
    /**
     * 服务地址
     */
    private String serviceAddres;
    /**
     * 服务最后续约时间
     */
    private long lastRenewalTime;

    public ServiceInstance(String serviceName, String serviceAddres, long lastRenewalTime) {
        this.serviceName = serviceName;
        this.serviceAddres = serviceAddres;
        this.lastRenewalTime = lastRenewalTime;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getServiceAddres() {
        return serviceAddres;
    }

    public void setServiceAddres(String serviceAddres) {
        this.serviceAddres = serviceAddres;
    }

    public long getLastRenewalTime() {
        return lastRenewalTime;
    }

    public void setLastRenewalTime(long lastRenewalTime) {
        this.lastRenewalTime = lastRenewalTime;
    }

    /**
     * 第七期HashMap HashMap底层 比较两个对象时  hashCode
     *
     * @param o
     * @return
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServiceInstance that = (ServiceInstance) o;
        return
                Objects.equals(serviceName, that.serviceName) &&
                        Objects.equals(serviceAddres, that.serviceAddres);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serviceName, serviceAddres);
    }
}
